#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

int main()
{
	char arr1[20] = "abcdefghijk\n";
	char arr2[20] = { 0 };
	//打开
	FILE* pfout = fopen("data.txt", "w");
	if (pfout == NULL)
	{
		perror("fopen->pfout");
		return 1;
	}
	FILE* pfin = fopen("copy.txt", "r");
	if (pfout == NULL)
	{
		perror("fopen->pfin");
	}
	//使用
	fputs(arr1, pfout);
	fputs("abc", pfout);
	while (fgets(arr2, 5, pfin) != NULL)
	{
		printf("%s", arr2);
	}
	//关闭
	fclose(pfout);
	fclose(pfin);
	pfout = NULL;
	pfin = NULL;
	return 0;
}